Start by defining the 'Other applications' in a query, for instance apps:
Then you can define the next Tier as:
You can create as many tiers as you need to in this fashion. To create a group with ALL core applications and NO OTHER applications you would use something like:
There's no command line for queries so you can't script the whole process, but if you have the skills you can do it with Web Services. Having said that, you can script creating the .cmsobj file then you will have to manually import it. You can create a sample .cmsobj file by creating a query that is representative of the query you need, then write a script to extend it. The format is not that difficult.