RAW is unclear about whether a mount and rider occupy the same space
One important question is whether a mount and its rider are considered to be occupying the same space, or whether the rider occupies a space above the mount's space. If they occupy the same space, then any area of effect that hits the mount can also be aimed in such a way that it hits the rider (although it is not guaranteed, since the mount is one size class larger, so it may occupy more space than its rider). If a rider is considered to be occupying a space above their mount, Then a horizontal area of effect, such as a Lightning Bolt fired approximately horizontally, will hit either one or the other but not both. That is, you could aim exactly at ground level and hit the mount, or aim at a slight upward angle and hit the rider on top of the mount.
Unfortunately, I can't find anything in the rules that specifies which of the above is the correct interpretation. The rules explain how to mount or dismount a creature, but they don't specify what that means in terms of relative positioning. This may be because there are a wide variety of possible shapes and sizes of mount (and rider!), so a general rule for all mounts might not make sense. Hence, the DM will need to make a ruling for a particular case.
Personally, I would rule that in the case of a griffon and humanoid rider, there is more than enough overlap between a rider and mount that there would be no problem hitting both with the same Lightning Bolt spell, regardless of the angle it is fired from.
Angle matters for line spells
Since you mentioned that the mount in question was flying, and presumably the wizard casting Lightning Bolt was on the ground, it is likely that the spell was fired at a potentially steep upward angle. In this case, even if the DM ruled that the rider occupied a space above the mount, the spell could still easily hit both of them if the angle is steep enough. In the most extreme case of firing 90 degrees straight up, the spell almost certainly will hit both of them.
The mount does not provide sufficient cover to protect the rider
The other possibility that might result in the rider not being hit by the spell is if the spell were entirely blocked by the mount, thus protecting the rider. However, a creature generally does not provide sufficient cover to block a spell. Generally, creatures provide at most half cover:
A target has half cover if an obstacle blocks at least half of its body. The obstacle might be a low wall, a large piece of furniture, a narrow tree trunk, or a creature, whether that creature is an enemy or a friend.
When shooting at a rider on top of a mount that is flying above you, it would be reasonable to grant the rider half cover (and to apply the optional rule about hitting the cover on a miss). However, as described in the section on areas of effect, only total cover is sufficient to block a spell's effect:
A spell's effect expands in straight lines from the point of origin. If no unblocked straight line extends from the point of origin to a location within the area of effect, that location isn't included in the spell's area. To block one of these imaginary lines, an obstruction must provide total cover.
Hence, as long as the Lightning Bolt passes through both the mount's and the rider's spaces, it will hit both of them, and neither one will block the spell from hitting the other.