Here's some general rules-of-thumb on the variable types and when to use each:
Local Variables
Most-commonly used type, but only stick around for the length of the routine. Released when the function ends.
Global Variables
Stick around after the function ends, and visible to everyone. As such, using them can result in inconsistent buggy behavior, since any other routine can clobber the variable (set it to some value that your routine doesn't expect and possibly can't handle). Should therefore be used sparingly. There are some valid uses, but not many. (In VLisp, global variables should have names that begin and end with an asterisk, as in *myglobal*.)
Drawing Variables
Variables stored in a dictionary in the drawing, either as a global dictionary or hooked to an object in the drawing. These variables are saved with the drawing, and are therefore drawing-specific. For example, the layer manager saves layer states in a dictionary attatched to the Layers collection.
Application Variables
Application-specific variables - i.e., variables specific to a routine. (In this context, you can think of any custom function you write as an "application".) Variables stored here are not drawing-specific; they retain their current value even if you close the current drawing and open another one. These variables are stored in the acad.cfg file, so they are remembered even if the Autocad session is terminated and restarted. These variables are accessed with the setcfg and getcfg functions. Since they are stored in the acad.cfg file, they should follow the naming conventions in the documentation to avoid conflicts with other programs/routines.
Environment Variables
Variables that affect the way a program runs. Accessed with getenv and setenv. You can also think of these as "startup configuration variables". Most commonly, these variables are used to specify important facts about the user's specific environment, such as path information, language settings, editor preferences, web browser preference, etc. Autocad uses them to store the default hatch and linetype definition filenames and a few other things. The documentation warns that once you change the value of an environment variable with setenv, you should not count on getenv returning the correct value until the next time you start Autocad. These variables are stored in the Windows registry, and as such may also be changed from outside Autocad.