This is rather intimidating. It’s not parsing Prolog, just looking for recognizable blocks of syntax. Dayum!
https://cgit.kde.org/syntax-highlighting.git/tree/data/syntax/prolog.xml
This made me laugh:
<!-- These are in fact bogus, DO NOT USE them and bug the ISO standard
commitee to abandon char_conversion/2 and to apply common sense to the
semantics of include/1 and ensure_loaded/1, i.e. to handle recursion.
Bomb them w/ e-mails! It's not the purpose of a standard to fixate
errors till eternity. -->