Parentheses, the symbols ( and ), are used in logic to present an order of operations, grouping formulas together in order to prevent ambiguity.
For instance, the expression P ∧ Q ∨ R is ambiguous. Does it mean “Either P and Q, or R”? Or does it mean “P and either Q or R”?.
Rules of well-formation dictate that for most operators, it is neccessary to group individual operations in parentheses.
Therefore, one would write either (P ∧ Q) ∨ R, or P ∧ (Q ∨ R), depending on which interperetation is desired. (P ∧ Q) ∨ R, for example, requires that P and Q be interpereted as a single formula, with its entire result, or truth value, then joining into the disjunction.
In some cases, square brackets are used in order to differentiate between different sets of parentheses. For exmaple, one may express a complex formula, [(P ∨ Q) ∧ ¬(R ∧ S)] → (T ∨ Q), using different sorts of brackets to make identifying the order of operations easier for the reader.
Mathematics has better-established conventions for the order of operations in ambiguous statements. For example, in the case of 1 + 2 × 4, the convention is to interperet the statement as 1 + (2 × 4), giving the result of 9, rather than (1 + 2) × 4, which would equal 12. The convention in math is that multiplication preceeds addition, although it is better practice to dictate the order of operations with parentheses.
Logic does not have such a well-established convention, and as a result, poorly-formed formulae are usually regarded as unintelligible.