To understand the principle of operation of Paul's code, with or without my extension, you just need to have a look into the K20 Sub-Family Reference Manual. Pages from 769 describe exactly the FTM configurations which will allow you to understand how the FTM clock, the FTM prescaler value, the FTM modulo value, and the FTM channel control value work together to obtain a PWM with specific frequency. There are basically two possible clock sources from which one does depend on F_CPU and one is fixed. Then there are 8 prescaler values. That means that there are only very few specific PWM frequencies at which native full 16bit resolution PWM is possible. And there are also limits for the PWM frequency (highest prescaler and modulo values). For all other frequencies, the modulo value has to be reduced to obtain the desired frequency which unfortunately reduces the resolution, too. That's why the analogWrite code scales the input value depending on analogWriteResolution() to match the reality.
Kudos to Paul for this approach which is easy to use, abstract, and thus most Arduino-ish because you can just set two parameters, frequency and resolution, and then start writing PWM values to a pin and that's it, fully without knowing which FTM is involved, at which clock source and with which prescaler and modulo value it runs and which resolution would theoretically be possible at that frequency. Unfortunately, that is totally intransparent, too, because without deeper knowledge of the FTM mechanisms, you never know and understand what really happens in the FTM, how your input value is processed to obtain the desired result, and where the limits are. And there is no simple access to other great FTM features like synchronized or center-aligned PWM, dead time insertion, and so on....