Numeric (octal) file permissions:
1 --x execute
2 -w- write
3 -wx write and execute
4 r-- read
5 r-x read and execute
6 rw- read and write
7 rwx read, write and execute
Therefore, 766 means "owner - read, write, execute", "group - read, write", "other - read, write". For a folder, execute is required in order to "open" the folder to gain access to its contents. Since your PHP is being run as an Apache module, the "other" user must have execute permissions. Thus 755, or 777. 755 is a bit more secure if you don’t need to have PHP write to the folder.
644 is usually quite good enough for most of the files in the MODx folders, since the owner can read and write (thus being able to update or delete the files via FTP), while the Apache user only needs to read them. Setting the config.inc.php file to 444 makes it very difficult to accidentally delete or change it, since you must first change its permissions to allow anyone to change or delete it.
Since the MODx PHP files are run through an interpreter (whether as an Apache module or a stand-alone CGI module), they do not need execute permissions, only read permissions so the interpreter can read them. If the file is written to be run from the command line directly (with the first line " #!/usr/local/bin/php"), it must have execute permissions in order to run.
Since usually PHP is an Apache module, a PHP script runs as the Apache server user, which would be the "other". That is why folders like the Cache folder have to be 777 on most of these systems, so that this Apache user (not the file’s owner, who is whoever put the file in place, usually your FTP user) can not only open the folder (execute) but also write to it to write the cache files.