The chemical reactions and pathways resulting in the formation of xyloglucan, the cross-linking glycan composed of (1->4)-beta-D glucan backbone substituted at regular intervals with beta-D-xylosyl-(1->6) residues, which is present in the primary cell wall of most higher plants.