Programmable voltage detector (PVD)
A comparator inside the microcontroller that raises an interrupt as the supply sags, before the brown-out detector pulls reset.
The brown-out detector is an emergency brake: once the voltage falls below its limit the chip is held in reset, and by then it's too late to do anything. The PVD, as ST calls it, sits one level higher. Firmware picks a threshold from a handful of steps between roughly 2 and 3 volts, and when the supply crosses it, an interrupt fires. NXP and others call the same thing low-voltage detect, or LVD.
That interrupt buys a few milliseconds: save counters to backup registers, abort a flash write in progress, shut down motors. Exactly how many milliseconds depends entirely on the capacitance on the supply rail, which is why a PVD and a hold-up capacitor tend to show up in the same design. Without the latter, the interrupt handler barely gets started.