Guild Rating is gained by winning guild battles and is lost by losing them. The higher the opposing Guild's rating compared to yours, the higher your reward for winning and the lower your penalty for losing.
The Guild Rating of your guild determines your place on the Guild Ladder and therefore your guild's ranking.
HA and HoH do not affect your rating.
The mechanics of Guild Rating
Guild Wars uses the wikipedia:Elo rating system to calculate ratings. In this system, the probability of winning is calculated for each guild, determined by the rating difference of both guild before the match. The higher this probability of winning, the less rating is gained by actually winning the match.
The formula for the winning probability is , where x is the opposing guild's rating and y is the guild's rating.
With this probability, the actual rating change can be calculated by R = y + K * (t – p). Where y is the guild's old rating; K is 30 during tournament play and 5 otherwise; t is 1 for a win or 0 for a loss, and p is the guild's win probability.