(Abridged) We present a molecular survey of the outflows powered by L1448-mm and IRAS 04166+2706, two sources with prominent wing and extremely high velocity (EHV) components in their CO spectra. The molecular composition of the two outflows presents systematic changes with velocity that we analyze by dividing the outflow in three chemical regimes, two of them associated with the wing component and the other the EHV gas. The analysis of the two wing regimes shows that species like H2CO and CH3OH favor the low-velocity gas, while SiO and HCN are more abundant in the fastest gas. We also find that the EHV regime is relatively rich in O-bearing species, as is not only detected in CO and SiO (already reported elsewhere), but also in SO, CH3OH, and H2CO (newly reported here), with a tentative detection in HCO+. At the same time, the EHV regime is relatively poor in C-bearing molecules like CS and HCN. We suggest that this difference in composition arises from a lower C/O ratio in the EHV gas. The different chemical compositions of the wing and EHV regimes suggest that these two outflow components have different physical origins. The wing component is better explained by shocked ambient gas, although none of the existing shock models explains all observed features. The peculiar composition of the EHV gas may reflect its origin as a dense wind from the protostar or its surrounding disk.