Check out this great blog post detailing implementing millis()
using avr-hal.
For a general Arduino intro on PWN see Secrets of Arduino PWM. This article goes into the detail of ATmega registers for configuring timers. Also check out sections 14-17 of the datasheet for details on timers.