Now the quarks that makes protons and neutrons are up and down quarks and they carry a charge.
Now up quarks has a charge of +2/3
down quarks has a charge of -1/3
So an arrangement of 2 down quarks and an up quark yields no net charge and you have a neutron.
An arrangement of 2 ups and a down, yields a charge of +1 and you have a proton.