boolean expression syntax checking
What you are describing is part of the area of knowledge known as compiler theory, specifically parsing. One of the classical books is the dragon book. Parsing and evaluating expressions like yours is usually done in three interlocked steps:


Lexical analysis. This part is in charge of converting the input into a sequence of "lexemes". It will convert your example into the lexemes "(" VARIABLE "=" NUMBER ")" "or" "(" VARIABLE ">" NUMBER ")". This step is implemented using regular automata.
Syntax analysis. This part construct a parse tree of your expression. In your case, the parse tree (generated using Miles Shang's online tool) will be:

This step is implemented using context-free languages, either using a table-based approach or using recursive descent.
Semantic analysis. In your case, this part will evaluate the expression recursively using the parse tree, making use of attributes stored at the meta-lexemes VARIABLE and NUMBER.