If it's sort of foamy and maybe a bit mucusy looking it may be bile.
Does he have any other symptoms such as diarrhoea, pain or discomfort (may be indicated by lip licking, pacing, looking hunched up, being restless, groaning or simply laying immobile)?
If in doubt please phone your vet for advice.