Headquarters, divisions, and groups are all used throughout AMG as a way of grouping and organizing employees. The codes used for each are just another way of differentiating between them. They are in order from highest to lowest in organizational level: Headquarters, then Divisions, then Groups.
They can be added, edited, or deleted in Company - Organization.
Headquarters are usually used for different companies, many people only use one.
Divisions are usually for different locations.
Groups are any other grouping of employees - sometimes the employee's position or the department they work in.
When you add an employee you will select the headquarter, division, and group they belong to. These are meant to be semi-permanent - they should not change on a regular basis. Groups are also similiar to jobs and departments if you have the Job/Department Costing feature enabled. See this article for the difference between groups, jobs, and departments.