How to enable .iml file highlighting in GitHub

If you have a GitHub repo with .iml files and want to have nice syntax highlighting in the GitHub web interface, add a .gitattributes file to the root directory of your repo with the following contents:

# Treat IML files as OCaml for syntax highlighting
*.iml linguist-language=OCaml

# Inclde in language statistics
*.iml linguist-detectable=true

Voilà!