Code Compare provides different depths of source comparison:
You can select the required approach in the Code Compare options.
To select comparison approach, go to the Comparison menu, select the Compare Text submenu, and then select the required menu item.
To customize the default comparison mode, in the Tools menu select Options, then in the displayed Options dialog box expand the Code Compare node, navigate to the File page and set the required value in the Compare content drop-down list.
Lexical comparison is supported for the following languages:
Lexical comparison is activated when the Symbol by Symbol mode is chosen. As this option is supported only for some of the languages, it is disabled by default.
You can see the advantages of such comparison from the following example.
The example below demonstrates advantages of lexical comparison as opposed to regular comparison.
Text comparison mode within Code Compare can be inconvenient for source code comparison as it does not recognize language elements and looks for similar symbols in totally different lexemes.
Regular text comparison algorithm
With lexical comparison enabled, different lexeme types are never compared with each other.
Lexical comparison - different lexeme types
Code Compare tool with lexical comparison enabled always compares numbers wholly. This is illustrated by the next screenshot.
Comparing numbers with lexical comparison mode
If you choose text comparison mode, the numbers will be compared digit-by-digit, which is irrational in the context of source code comparison.
Comparing numbers with text comparison mode
Ignoring comments can be enabled in the Comparison menu.
With this option enabled, comparison tool will disregard any source code comments and highlight the blocks different by this sign only as unchanged.