Basically, the tree that you have selected when you level up will get the next upgrade in its respective queue. The next upgrade for each tree is listed when you hold down the Select button, and each tree's unlock progressions are listed in the main menu. It also doesn't matter if you change trees halfway between levels. The one that is selected at the time you level up is the one that is upgraded.
For example, if you have Assault selected at the time you level up, you'll unlock the next upgrade listed for the Assault tree.