HCE is defined as being above 120k$ or in the top 20 % of the company. The exact cutoff point might be different for each company. Typically, only the base salary is considered for that, but it's the company's (and 401(k)-plan's) decision.
The IRS does not require HCE treatment; the IRS requires that 401(k) plans have a 'fair' distribution of usage between all employees. Very often, employees with lower income save (over-proportionally) less in their 401(k), and there is a line where the 401(k) plan is no longer acceptable to the IRS.
HCE is a way for companies to ensure this forced balance; by limiting the amount of 401(k) savings for HCE, the companies ensure that the share of all contributions by below-HCE is appropriate. They will calculate/define the HCE cutoff point so that the required distribution is surely achieved.
One of the consequences is that when you move over the HCE cutoff point, you can suddenly save a lot less in your 401(k). Nothing can be done about that.
See this IRS page: https://www.irs.gov/retirement-plans/plan-participant-employee/definitions
Highly Compensated Employee - An individual who: Owned more than 5% of
the interest in the business at any time during the year or the
preceding year, regardless of how much compensation that person earned
or received, or For the preceding year, received compensation from the
business of more than $115,000 (if the preceding year is 2014;
$120,000 if the preceding year is 2015 or 2016), and, if the employer
so chooses, was in the top 20% of employees when ranked by
compensation.