My friend mentioned how Atom ‘naturally’ identifies a grammar/language at the moment. The easiest way would be to have extensions to the files. By no means is it the only way.
Method 1 - The grammar is indicated in the lower right corner. Mouse-click on this will bring up a dialog from where the correct grammar can be selected.
For method 2 you should identify some identification ‘marker’ that the script can use. It can be a file name or folder name for example. Meta data could also work - if you know how to extract this from the file with the script.
Not to what you are after, but the underlying idea is given: Can Atom interpret my #!/bin/bash shebang?