Your rating increases with victories and decreases with losses. It's used to let others know your skill level and to match you with players of similar rating. Defeating stronger opponents gets you greater rating gains, while losing would decrease your rating less than when playing against a similarly skilled player.