You can set the syntax on a per-file basis by using the gear icon at the bottom of the editor window to select a Syntax Mode. That's great for new files that aren't saved yet or files with weird one-off extensions.
For something more permanent, you can specify a file extension to go with a syntax mode. This is under Preferences → Editor → Custom Syntax Modes (at the bottom). Set the extension of the file, without the period (for example gem
for ruby gem files) and the syntax mode you want to use for that file type (for example Ruby
).