XGBoost ranking file format
Since I asked this question, it seems the documentation was expanded:

We need to provide a ".group" file. For example, the file could be


2
3

  
  This means that, the data set contains 5 instances, and the first two
  instances are in a group and the other three are in another group. The
  numbers in the group file are actually indicating the number of
  instances in each group in the instance file in order.