The study of the genetic changes that occur in viruses over time, including how they adapt to new hosts and environments.