Furthermore, the LaTeX syntax makes it easier for the computer to parse the document and distinguish actual text from equation symbols.
In that case, I would argue that it's not easy at all with (La)TeX. The obvious difficulty is people mucking about with cat- and char- codes; but, even if that's not happening, you've got things to worry about like old-style `$ $` and `$$ $$` delimiters. I've never seen a highlighter handle `$\text{$math$}$`, or even `\(\text{\(math\)}\)`, correctly.