Some say that even coffee can count towards your daily fluid intake, despite the effects of caffeine.
I'd say that green, white and red teas (the first two have low levels of cafeine in, the third is caffeine-free) as well as juices,, and even 'wet' foods (soups, lettuce, cucumbers, watermelon, etc. ) count towards hydration. Herbal teas would as well.
I think the "8 glasses of water" is based on the typical American diet, which is low in fruits and veggies (which contribute to hydration) and high in processed and concentrated foods.