Everything in setup() is local to setup. Whereas everything above setup is global. So if you were to define a variable in setup, the rest of your program would not see it.
When you declare variables outside a function they are global and can be accessed throughout the program. But when you declare variables within a function they are only visible within the function and are normally discarded when the function ends. If you want local variables to persist you can prefix them with "static".
pinMode() is different because it is a call to a function and that should go within setup().
Note that the function's name is "setup" and the word "void" is there to tell the compiler that the function does not return any value when it completes.
pinMode can be used within loop() also, if you wanted to change how a pin was used.
An example could be a "soft-I2C" with 1 master and several slaves. The master, the 328P in this case, could set SCL as an output, but SDA would need to toggle between output to send slave addresses and data, and then input to receive results back from slave.