A global intro to the Ribbon is available on the Microsoft site at http://msdn.microsoft.com/en-us/library/aa338202%28v=office.12%29.aspx. Be sure to check out parts 2 and 3, links to which are located in left menu of that page above.
More specifically, you might find some useful guidance on building a Gallery at http://msdn.microsoft.com/en-us/library/dd904887%28v=office.12%29.aspx.
In terms of modifying the XML behind ribbons, I use the Custom UI editor. You can download it at http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2009/08/07/7293.aspx