You can set the sort order for each category in its editing page. The headings are associated with a particular category; there is not a way to automatically have certain categories sort themselves under a heading, so you have to manually make sure that the heading goes on the first category you want in a group.