Is it safe to shutdown my PC by pressing the power button
- while it's in the BIOS setting mode?
- while it's in a bootloader (in my case grub), without a timeout?
If not, are there any good way to shutdown ASAP?
All that said... repeatedly turning the computer off in a short period of time could damage the power supply and/or motherboard capacitors, or possibly even your hard drive. By "repeatedly" I do not mean twice in 10 minutes. I mean multiple times per minute. Having to turn the power off at these points once in a while is not going to hurt your system. Making a habit of it is only inviting trouble.
Try to figure out why you need to turn the computer off rapidly almost as soon as you turn it on, and try to eliminate this need.