The equivalent of garden-path sentences in formal languages would be shift-reduce conflicts and most pedanticly strict grammars are specifically designed to avoid that kind of problem, so that they can be parsed efficiently.
The purpose of a syntax highlighter is so that the human knows that the computer agrees on what the sentence/code structure is.