What is generator 2 and 5?
Understanding this requires some amount of mathematical background. Diffie-Hellmann operates on cyclic groups. These groups all have in common that there is at least one generator, i.e. an element that can be used to generate all other elements of the group.
Let's look at an example:
Z_11*: Set of integers i = 0,1,...,10 for which gcd(i,11) = 1. This is an abelian group under multiplication modulo 11.
Generator: a = 2
a^1 = 2 mod 11,a^2 = 4 mod 11,a^3 = 8 mod 11,a^4 = ( 16 =) 5 mod 11, a^5 = ( 32 =) 10 mod 11,a^6 = ( 64 =) 9 mod 11,a^7 = ( 128 =) 7 mod 11,a^8 = ( 256 =) 3 mod 11,a^9 = ( 512 =) 6 mod 11,a^10 = (1024 =) 1 mod 11
As you can see, we generated the whole group, i.e. we've got each element as result. Note however, that this will work on all kind of groups, and is not limited to multiplicative group of integers modulo p.
How does choosing 5 instead of 2 affect the security?
No, the Diffie-Hellman problem is all about the size of the cyclic group, not about the element(s) that generate the group. So when both elements are generators for a group, it doesn't make a difference. Choosing 2 as generator has a couple of advantages, though, because you can implement the underlying algorithms more efficiently.
Personally I wouldn't change the default here, unless there is a very good reason to. This is obviously not the case, otherwise you wouldn't have to ask ;).
Is this specific to OpenSSL?
No, this follows from the mathematics of cyclic groups itself.