index.php?foo=bar
calls the page index.php and sets the variable $foo to the value "bar".
so it is pretty much the same like having the following at the beginning of index.php:
$foo = "bar";
or more accurately
$_GET['foo'] = "bar";
the file it calls must be php-parsed. by default servers parse .php files (as long as a server and php is installled properly), but you may also change the settings in your server config so other file types are being parsed too.
an easy example to see how it works:
store a file test.php including the following code:
<?PHP
print "Welcome " . $user;
?>
now call it like
test.php?user=YOUR_NAME_HERE
the output should explain what it does...