Grouping menu category items in Printer/receipt Templates

We have a documentation for V3 here Grouping on Ticket Printer Template [SambaPOS V3]

It will work fine for V4 too. Additionally we have custom product tagging feature on V4

… and like John suggested you can use PRODUCT TAG:x as grouping key.