What is the reason for the shift in balance between neutrons and protons in the early universe? In the book of The First Three Minutes by Weinberg, on pages 106-107, it is stated that

SECOND FRAME. The temperature of the universe is 30,000 million
degrees Kelvin [...] The nuclear particle balance has conse- quently
shifted to 38 per cent neutrons and 62 per cent protons.
[...]
THIRD FRAME. The temperature of the universe is 10,000 million degrees
Kelvin. [...] The decreasing temperature has now allowed the
proton-neutron balance to shift to 24 per cent neutrons and 76 per
cent protons.

What is the reason for this balance shift between neutrons and protons? And what determines the rate of change of the neutron/proton ratio?
 A: Neutrons  decay into protons; there are no free neutrons presently floating around in space as their mean lifetime is about fifteen minutes.
For the first three minutes this table is instructive:
. For $10^{11}$ Kelvin the universe is mostly photons of very high energy, their interactions generating by pair creations particles which are also very high energy. Strong interacting particles, quarks, will bind into hadrons, including neutrons and protons . The neutrons do not have time to decay before a scattering changes them. Thus there is about an equal number of protons and neutrons.
. For $3X10^{10}$ Kelvin the energy available for statistical scattering interactions has fallen, and some of the neutrons have time between scatterings that allows measurable  decay into protons.
I suppose the successive numbers in your quote come from  actual model calculations of the statistical balance between decays and interactions in the time available between statistical scatterings.
As the energy available for scatters decreases further in the time scale of the  creation of the universe, the neutrons become less and less, and the ones that survive are the ones binding in nuclei with protons, like Deuterium and alphas.
So the reason is that the expansion of the universe decreases the number of scattering between the constituents which gives time for the neutrons to decay into the stable protons. More protons survive scatters intact, (i.e.do not turn into neutrons by the interaction) than neutrons (which  have time to decay into protons).
A: There are two very relevant facts that inform this answer: (1) The rest mass energy of a neutron is 1.29 MeV higher than that of a proton. $(m_n - m_p)c^2 = 1.29$ MeV. (2) The total number of neutrons plus protons (essentially the only baryons present) is a constant.
Neutrons and protons can transform into one another via reactions moderated by the weak nuclear force. e.g.
$$ n + e^{+}\rightarrow p + \bar{\nu_e}$$
$$ p + e \rightarrow n + \nu_e$$
Because of the rest mass energy difference, the first of these reactions requires no energy input and the products have kinetic energy even if the neutron were at rest. The second does require energy (at least 1.29 MeV) to proceed, in the form of reactant kinetic energy.
In the first second of the universe, with temperatures higher than $kT >10$ MeV ($10^{11}$K) these reactions are rapid, and in balance (occur with almost equal likelihood) and the $n/p$ ratio is 1. i.e. Equal numbers of neutrons and protons.
As the universe expands and cools to less than a few MeV (a few $10^{10}$ K) two things happen. The density of reactants and the reaction rates fall; and the first reaction starts to dominate over the second, since there are fewer reactants with enough kinetic energy (recall that the kinetic energies of the particles are proportional to the temperature)  to supply the rest mass energy difference between a neutron and proton. As a result, more protons are produced than neutrons and the $n/p$ ratio begins to fall.
The $n/p$ ratio varies smoothly as the universe expands. If there is thermal equilibrium between all the particles in the gas then the $n/p$ ratio is given approximately by 
$$\frac{n}{p} \simeq \exp\left[-\frac{(m_n-m_p)c^2}{kT}\right],$$
where the exponential term is the Boltzmann factor and $(m_n - m_p)c^2 = 1.29$ Mev is the aforementioned rest-mass energy difference between a neutron and a proton. The rate at which $n/p$ changes is simply determined by how the temperature varies with time, which in a radiation-dominated universe is derived from the Friedmann equations as $T \propto t^{-1/2}$ (since the temperature is inversely related to the scale factor through Wien's law).
In practice, the $n/p$ ratio does not quite vary like that because you cannot assume a thermal equilibrium once the reaction rates fall sufficiently that the time between reactions is comparable with the age of the universe. This in turn depends on the density of all the reactants and in particular the density of neutrinos, electrons and positrons, which fall as $T^3$ (and hence as $t^{-3/2}$). At a temperature of $kT \sim 1$ MeV, the average time for a neutron to turn into a proton is about 1.7s, which is roughly the age of the universe at that point, but this timescale grows much faster than $t$.
When the temperature reaches $kT = 0.7$ MeV ($8\times 10^9$K) after about 3 seconds, the reaction rates become so slow (compared with the age of the universe) that the $n/p$ ratio is essentially fixed (though see below$^{*}$) at that point. The final ratio is determined by the Boltzmann factor $\sim \exp(-1.29/0.7)= 1/6.3$. i.e. There are six times as many protons as neutrons about three seconds after the big bang.
$^{*}$ Over the next few minutes (i.e. after the epoch talked about in our question) there is a further small adjustment as free neutrons decay into protons,
$$ n \rightarrow p + e + \bar{\nu_e}$$
in the window available to them before they are mopped up to form deuterium and then helium. During this window, the temporal behaviour is
$$ \frac{n}{p} \simeq \frac{1}{6} \exp(-t/t_n),$$
where $t_n$ is the decay time for neutrons of 880s. Since the formation of deuterium occurs after about $t \sim 200$s this final readjustment gives a final n/p ratio of about 1/7. 
