Local variables are variables that can be accessed only within the function or block that they are defined. Local variables are defined in torque as %somevar.
Global variables are variables that can be accessed not only within a function or block, but also from anywhere in the game engine.
Global variables can be defined as $somevar but typically they are found as $group::subgroup::somevar.
For example $pref::GuiEditor::drawBorderLines is a global variable that is used by the GuiEditor.
This layout is mostly for organization, but also because some functions (like exporting preferences) can act on all global variables with some prefix. For example,