A file format specification can include a grammar definition, used for syntax highlighting, and to help define which differences are important.
For example, our standard file format for C/C++ source code includes a grammar that recognizes keywords, comments, and literal strings. By flagging differences in comments as unimportant, you can better concentrate on important differences.
A grammar definition in Beyond Compare is fairly simplistic. It does not support nested or context-specific definitions, so it doesn't handle tagged languages like HTML and PHP very well. On the other hand, it is a big step up from Beyond Compare 2's functionality.
To edit a grammar, pick Tools > File Formats and find the appropriate file format. Switch to the Grammar tab and edit the grammar items.