Actually, that's not the question you asked. You asked about microcontrollers in general, not PICs specifically. And the answer is only partly correct: if you write code depending upon features present in the higher-end PICs but not in the lower-end ones, that code will not work properly in lower-end PICs, regardless of the include file.
You can write code targetted at a range of uCs, as long as the code works within spec on all of them. Writing code which could run equally well on an 8051, a PIC, or an ATMEGA would be worth it only if the program didn't rely on any of the advanced features of any of the uCs. Choose the environment and code to it.
Within a family (like PICs) you could do some makefile magic to make it work, but I don't think it would be worth it.
Torben