Extended messages can be enabled at any time. However, doing it before opening the channel ensures that all received messages contain this information. The reason it is done after opening the channel in the demo is because the demo is intended to run with any ANT module, including parts that do not support extended messaging (i.e., if the command to enable extended messages fails, it will not break the flow of the program).
A good way of trying the effects of different commands and the sequence is to use ANTware to try out the commands.