The regulations on what can be logged for flight time are under 61.51.
(j) Aircraft requirements for logging flight time. For a person to log flight time, the time must be acquired in an aircraft that is identified as an aircraft under Sec. 61.5(b), and is--
(1) An aircraft of U.S. registry with either a standard or special airworthiness certificate;
(2) An aircraft of foreign registry with an airworthiness certificate that is approved by the aviation authority of a foreign country that is a Member State to the Convention on International Civil Aviation Organization;
(3) A military aircraft under the direct operational control of the U.S. Armed Forces; or
(4) A public aircraft under the direct operational control of a Federal, State, county, or municipal law enforcement agency, if the flight time was acquired by the pilot while engaged on an official law enforcement flight for a Federal, State, County, or Municipal law enforcement agency.
The list of what qualifies as an aircraft is in section 61.5
Certificates and ratings issued under this part.
(b) The following ratings are placed on a pilot certificate (other than student pilot) when an applicant satisfactorily accomplishes the training and certification requirements for the rating sought:
(1) Aircraft category ratings--
(vi) Powered parachute.
(vii) Weight-shift-control aircraft.
(2) Airplane class ratings--
(i) Single-engine land.
(ii) Multiengine land.
(iii) Single-engine sea.
(iv) Multiengine sea.
The following sections indicate what are included under the other categories.
So, piloting a hot air balloon counts toward the flying hours, as long as you're rated for it, but not the airplane hours. Since ultralights don't have an airworthiness certificate they don't fit under 61.51 (j)(1). Therefore no logging hours in those.
That's the FAA's requirements. Employers and insurance companies can have additional requirements. An example of this is that to qualify under the "open pilot" clause of someone's insurance policy (if they have one) it's pretty common for insurers to require a pilot to have 500 hours of PIC time, 10 of which have to be in the specific model. Depending on the contract, "model" can mean, for example, that time logged in a Cessna 172R doesn't count for the 10 hours required in a 172S.