I haven't thought deeply on this, but for programing/scripting languages, one way could be to break them up in their general syntax style, for an incomplete example:
* Pascal-style - Ada - Pascal - Coffeescript - Lua - Ruby
* C-style - C - C++ - C# - D - Go - JS - Java - Rust - Vala
* Python-style - Python - Genie - Nim
* Lisp & Functional-style - Lisp - Scheme - Clojure - Erlang - Haskell
It wouldn't be perfect, and the "C-style" group would have a lot of languages, but at least it's better than the incorrect/non-existent distinction of "Programming" vs "Scripting".
Another more obvious way would be to group them alphabetically, collapsing ranges of letters together where there aren't very many languages (to avoid a large 26 item menu with few items in each submenu).
Just a couple ideas.