Technically, different apps don't really "reprogram the keys". Keys simply send a "scancode" to the processor. During start up these keys are first interpreted by the BIOS and then by the Operating System which is triggered to do certain actions by the scan codes.
During normal running the OS interprets the scancode and produce a character code which is why a keyboard can be changed to another layout for different languages. It is common geek joke to set someone's keyboard to another language.
Most programs receive the character code and the program is designed to interpret this code in certain way. That interpretation can be changed within the program to do different tasks.