If I set a file to chmod 777 in general webspace area, can anyone access and alter that file?
Any user, yes. Assuming they have access to get to the directory it's in.
Or do they require some proper connection like through a ftp.
Yes, they'll need to be using a program on your server that is capable of modifying files. A web vistor is not a user. An FTP account is. Apache children will run as users, but normally apache doesn't modify files. PHP will run as a user.
My thinking is that someone could execute a php script on there [sic] own server that alters the chmod 777 files!
You mean virtual servers or shared hosting? Worrying about another user on your server is a valid concern. Whether they can access your files depends on how your server has been set up (it's often set up quite poorly.) If your home directory has permissions only for you, no one will be able to get at your files regardless of their permissions. This is a question for your host.
There are also other security mechanisms that can be used to keep people out of each others' files, such as chroot.