TL;DR - disable the Package Checker plugin. Or maybe all plugins to see if it helps at all (kinda, run IDE in the "safe mode")
Longer story below:
I had a very similar problem, quite irritating one, and this question is the closest to what I had. So writing my findings here - maybe it will help someone else too.
I have IntelliJ Community Edition (tried versions from 2022 to 2024) in a corporate environment, behind firewalls, proxies, etc, i.e. probably quite tough environment for the IntelliJ which might try to access network for various reasons, with some sites and HTTP requests working and some not.
Anyway, one day the syntax hightlighting and overall the code inspection went out of the window. Correct parts of the files might be red, incorrect are not highglighted. Cleaning up cache the did not help. Re-cloning the repo, full reinstall and upgrading to the latest version of IntelliJ did not help.
In the IntelliJ logs, I saw this exception at pretty much every startup:
SEVERE - #c.i.c.d.i.PassExecutorService - java.lang.IllegalArgumentException: JBAccountInfoService is unavailable
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: JBAccountInfoService is unavailable
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
...
at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:80)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:57)
...
So, looked like highlighting was stumbling upon some account problem?? It was very puzzlying.
Fortunately, the answer above about the Grazie plugin gave me the clue. Disabling Grazie did not change the situation for me, but gave me an idea to disable all the plugins, which suddenly returned the situation back to normal.
After switching the various plugins on/off, I found the culprit - for me it was the Package Checker plugin. Some bundled plug-in, I don't even know what it's doing, and I got absolutely no idea why it affects the highlighting.
Also, after a closer examination of the call stack for the exception mentioned above, I found that indeed it comes out of that plugin, since there were these lines too:
...
at com.intellij.packageChecker.service.PackageChecker$Companion.getInstance (PackageChecker.kt:311)
at com.intellij.packageChecker.service.HeadlessSynchronizationService.<init>(HeadlessSynchronizationService.kt:32)
...
Just, iniatially I did not pay attention to these packageChecker lines because nothing there gives a clue that it's some kind of a plug-in (it says just com.intellij.packageChecker! Just that was not enough to catch my eye). But, now when I know about this plug-in - the exception definitely comes from it, as the call stack says.
Anyway, disabling the Package Checker plug-in helped me. If someone else's got a similar story and disabling the Package Checker plugin does not help, I'd recommend to disable all the plugins first - if it helps, find the bad boy by switching them on and off with binary search approach.