It's pretty easy, you can make a multi-criteria advanced search or have a look to the risk repport which natively displays the accounts that have the same Legal ID :

The Legal ID is a consolidation key for customer risk assessment. It is also useful for other reasons as long as it is well filled in your ERP.
If you have the same acocunts payable contacts for several customer accounts and you want to group all these accounts for collection, you just have to copy / paste the account numbers in the customer search and group the collection !
To group the collection, a similar Legal ID isn't mandatory.