The BIOS is a firmware program (a program stored on chip memory) stored on ROM or an EEPROM (Electrically Erasable Programmable Read Only Memory). EEPROMs can be updated with new versions, but can also be infected with rootkit viruses.
The BIOS performs POST (power on self test) to test the hardware to check it is all functioning correctly.
It also stores and uses settings in EEPROM or CMOS (complementary metal-oxide semiconductor) RAM, for example the boot order and overclocking settings. The BIOS can be reset to default settings by short circuiting 2 pins to clear the CMOS.
The bootloader is also loaded from the first device that contains one. The bootloader is the internal software used to boot the computer and subsequently load the kernel and OS.
BIOS has been replaced by UEFI (Unified Extensible Firmware Interface), which provides many more features including remote diagnostics, inbuilt web browsers and graphical user interfaces, without needing an OS.