Tasbar Sorter Utlity allows you to sort all windows showing in your taskbar the way you want. Yes you can arrange all the windows by simple re-ordering in the utlity and hit sort. By default this sorting brings all related applications together. It works in Vista and should work in Windows XP also.
This prorgam is availble at Codeu Guru and the idea is very simple. It just find all the list of availble windows and gives you in list box. Now you can drag and drop in order you want. When the sort button is hit, it just hides all of the windows and then shows you back in the order you wanted. You would see this happening when you use it.