The setting of the game is Fate/Stay Night's version of the Nasuverse. This link works well for any Servant or Master with knowledge about the War of the Grail.
http://typemoon.wikia.com/wiki/Category:Fate/stay_nightTL;DR: The Holy Grail is a ritual in which 7 Servants plus the 8th, Avenger, are summoned. It is a Battle Royale with the Holy Grail - a vessel rumoured to grant any wish - as the ultimate prize. Only when the last Servant is standing the Holy Grail appears and due to that fact killing the Masters is optional but highly advisable.
Servants are extremely powerful spirits who can take a physical form to affect the material world. While in spirit form they are like ghosts, but they also save some of the magical energy they extract from their Masters to stay in our world.
Masters are magi. Each magus usually spends all of their lives studying and training for the Holy Grail War. Each Master is granted a command spell (usually seen as something akin to a tattoo etched on the skin of the magus) with three uses.
Each use allows to bend the Servant's will to one order of the Master, even if it happened to be impossible by normal means. For example, if the Master happened to be in danger and far away from the Servant, if he used the command spell and called for his spirit, the Servant would be teleported to his side, even if such magic happens to be impossible normally.
As long as a Master has a command spell, he can take a Servant that has no Master, either by killing him or being released in some way. The Masters use only two out of the three commands due to the fact that the last order is to fetch the Holy Grail. After losing the command spell, a Master is useless for his Servant and the latter usually searches for other Master after killing his last one.