Works for capital ships that are grouped together, as well.
The feature is called sub-grouping, by the way. All units in your selection are "sub-grouped" by type, with large units (capital ships and superweapons) grouped alone. Tab cycles through each subgroup in your current selection. This is actually a feature that was introduced to the genre by Warcraft III nearly a decade ago. It was really revolutionary, but has never gained much mainstream attention despite its immense usefulness.