Each file has a structure, like (fictional example):
Code:
Human.m2
----
magic: M2, String (3 bytes)
boneTableOffset: uint32 0x5
boneTableValue: uint8 1
boneTableValue: uint8 5
boneTableValue: uint8 10
This structure has changed between WOTLK, Cataclysm and MoP. As far as I am aware, the 4.0.6a and 3.3.5a structure is the same, but it changed after 4.0.6a. If this is the case, there are existing tutorials on Modcraft - The community dedicated to quality WoW modding! - Index page that explain how to convert the model.
Basically the process is to edit the data to match that of the structure required in the new version. The structures are documented on the wowdev wiki. There is a template file for 3.3.5a WOTLK for 010 editor that can be used to get the data the same much easier. Once the M2 file is valid, it will be loaded fine by the template without error. Also the skin files needs converting which do not have a template but are much more simple.
Also you will need to add the new data to the DBC's. You can copy the 5.x data across where relevant using common sense, this part is easy once you understand each file that needs changing.