Replacing Apple's Function Keys Only for the Active App

For replacing the behaviour of hardware keys, you need to go lower than Keyboard Maestro, and use a tool like Karabiner.

Keyboard Maestro can remap regular keys (including function keys) using hot keys, but hardware keys like brightness cannot be remapped with the hot key API. (not that the Fn modifier behaves as a kind of hardware toggle, making a single key act like two different keys - Keyboard Maestro can remap the key when it behaves like a function key, but not when it behaves like a hardware key, even if it is the same physical key).