I could be wrong - but I'm pretty sure the in-built sort feature includes alphabetical as well as numerical searching. You'd have to move the text over to be the first index on the X axis, but then the in-built sort function should work fine.
EDIT: Sorry - just re-read your post. To move a group to the top of the list, simple iterate through the array checking for the identifier you're looking for. When you find that identifier, push a new value to the front of the array containing the values from that index - then delete the original index.
If you want everything grouped beforehand, you'll need a place to store a list of all of the text values stored in the third column, then perform the above process for each item on that list.