Guidance on implementing a custom ranking objective

I’m hoping to implement a custom ranking objective and I’m not really sure how the grouping functionality works or is utilized during learning. It isn’t really documented. More generally, does anyone have pointers to examples of custom ranking functions, or at least suggestions about portions of the source code that I should look at to understand how I might implement a custom ranking function?

Thanks