I don’t have that manual/listing in front of me, but generally I put FreeRTOS item handles at global scope (or part of a structure that is at global scope) to make it easier for the different pieces to access it.
In general, and especially for things like the Cortex-M3, there shouldn’t be items declared in the scope of main (maybe a loop counter for loops in the setup code in main), as those aren’t available to other functions, and on many ports, the Arm included, the main function stack gets reused as the interrupt stack, so any object declared their might get overwritten.
Looking in the book text, it doesn’t show where the semaphore is
declared, but you have the source code available too so you can look in
there. I would suspect it will be a file scope static.