Settings → Groups creates groups with a name and colour (rooms, floors, owners…). A device is in one group: set it in the Group field on its page, or on the Devices page, which has a group column and filter and a Set group of listed… box that puts all devices currently listed (after your filters) in a group at once. On the map, Colour by group paints devices by group (ungrouped ones are grey, with a colour key) and the group filter shows one group at a time. The Home Assistant integration uses the group as the suggested area of a tracked device. Deleting a group keeps its devices. The group name is part of the statistics summary (device_list[].group).
Add many devices to a group at once
Settings → Display → Groups has an Add devices to a group section: pick the group, filter the device list (by name, address or group; by default only devices without a group), tick devices or press Select all shown, and add them in one step. The same section can take devices out of their group. To change other things for many devices (known, always-on, alerts, type), see Edit many devices at once.