Usually because the text editor is limited to regular expression and region matching, while the IDE parses the language into an AST so it knows what each bit actually means.
What I meant was that the limitation in highlighting is usually due to the limitation in pattern matching. Of course, IDEs usually contain text editors, and they often do highlight using an AST. But that's expensive, both to develop and to run, and especially if you're not going to use the AST for any other IDE-like activity. Pattern-matching is cheap and usually good enough.
Okay, you are not talking about a problem in principle but how it practically is in reality. I don't know if text editors like Sublime/Atom also have that problem but when it comes to vim I can agree with that. Wouldn't wonder if there are some better external highlighters that can be integrated with vim. I heard that people use a vim plugin for using external linters for static analysis of code and spell checking.
And just to make sure, we agree that adding a feature like AST based highlighting wouldn't make an editor an IDE, right?