The keyboard scan codes are built into the keyboard - they are reported on USB, PS/2, Bluetooth, or whatever other interface is used. Then it is up to the software controlling it to interpret the scan codes in the way it wants.
Simple software, such as the BIOS, only does simple handling - typically not supporting different keyboard layouts.
DOS and Windows support a variety of layouts, which is chosen by configuration of the OS - it is completely independent of the BIOS, and of whatever keys happen to be on the keyboard. The US keyboard layout on Windows is pretty simplistic - amongst other things it makes little distinction between the left and right Alt keys (though only the right one works with the numeric keypad for entering ASCII/utf codes), and it has no support for dead keys.
Many international keyboard layouts are a bit more sophisticated, with a separation between Alt and AltGr (right-hand Alt) which lets you use the normal Alt for menu shortcuts, etc., and the right-hand AltGr to get more symbols, accents or letters required for other languages. They also generally support dead keys.
A dead key is one that does not generate any character when pressed, until you press another key. For example, in many layouts the backtick ` is a dead key. Pressing it does not produce anything unless you follow it with a space or a new ` to get a ` symbol. But if you follow
More advanced software, such as X, support much more configurable keyboard setups, and many more accessible characters.