Syntax:
The area of syntax specification has been thoroughly studied and Backus Naur Form (BNF) is widely used for defining syntax.
<loop>::= while <Boolean expression> do <compound statement>
The underlying formalism are context free grammars which in turn are based on set theory.
Note: correspondence between languages BNF definition and parsers.