diff --git a/Text/Highlighting/Kate/Common.hs b/Text/Highlighting/Kate/Common.hs
--- a/Text/Highlighting/Kate/Common.hs
+++ b/Text/Highlighting/Kate/Common.hs
@@ -285,10 +285,12 @@
 pDetectSpaces :: KateParser [Char]
 pDetectSpaces = many1 (satisfy $ \c -> c == ' ' || c == '\t')
 
+-- http://docs.kde.org/stable/en/applications/kate/kate-highlight-rules-detailled.html says this is
+-- [a-zA-Z_][a-zA-Z0-9_]*
 pDetectIdentifier :: KateParser [Char]
 pDetectIdentifier = do
-  first <- letter
-  rest <- many alphaNum
+  first <- letter <|> char '_'
+  rest <- many (alphaNum <|> char '_')
   return (first:rest)
 
 fromState :: (SyntaxState -> a) -> KateParser a
diff --git a/changelog b/changelog
--- a/changelog
+++ b/changelog
@@ -1,3 +1,8 @@
+highlighting-kate 0.5.8.4 (15 Jul 2014)
+
+  * Fixed DetectIdentifier so it allows underscores.  (This reflects a
+    change in kate some time since this library was first written.)
+
 highlighting-kate 0.5.8.3 (19 Jun 2014)
 
   * Added pure language.
diff --git a/highlighting-kate.cabal b/highlighting-kate.cabal
--- a/highlighting-kate.cabal
+++ b/highlighting-kate.cabal
@@ -1,5 +1,5 @@
 Name:                highlighting-kate
-Version:             0.5.8.3
+Version:             0.5.8.4
 Cabal-Version:       >= 1.10
 Build-Type:          Simple
 Category:            Text
