That's not actually a legend. It's commonly known as a feature index (or more commonly, a specific kind is a street index, but the idea is the same).
You might find Ben's question and Yovav's answer in the thread at https://community.esri.com/people/Yovavzsystematics-co-il-esridist/blog/2014/08/05/creating-grid-ind... relevant.