General considerations
It’s not the basicity that is the important factor here, it is the nucleophilicity. The hydride ion, whether present as tetrahydridoborate or as a lone hydride is a very lousy nucleophile while an alcohol is an okay-ish nucleophile. The general mechanism of the addition is given in scheme 1.
Scheme 1: General mechanism of a nucleophilic attack on a carbonyl.
Now in the case of a hydride — a very weak nucleophile — this reaction is generally slow. It is faster, the more reactive — electrophilic — the carbonyl species is. If $\ce{X}$ is a carbon or hydrogen atom, then all we have is a localised double bond without any significant reduction in reactivity.[1] Reactions with those should thus be fast. If $\ce{X}$ is an element that has a lone pair, such as oxygen or chlorine, then there is a notable mesomeric stabilisation as shown in scheme 2.
Scheme 2: Mesomeric stabilisation by lone pairs next to a $\ce{C=O}$ double bond.
This stabilisation is not strong if a chlorine atom is $\ce{X}$ since chlorine is much larger and its lone pairs are more disperse. The stabilisation is stronger in the case of acid anhydrides; however, since a single oxygen has to stabilise two carbonyls it is still not too strong. In esters, carboxylic acids (and their anions) and most so in amides this stabilisation is very strong ad nucleophilic attacks difficult. This explains the general electrophilicity trend:
$$\text{aldehydes} > \text{ketones} > \text{acid chlorides} > \text {acid anhydrides} > \text{esters} > \text{amides}$$
Now let’s look at the reactions in detail. Throughout this post I will assume neutral conditions only; no acid or base catalysis.
The hydride attack
As I already noted, hydride is a bad nucleophile. It makes sense that it can attack the first members of the series — aldehydes, ketones and acid chlorides — but fails to do so for more stabilised members. For completeness, the mechanism of a hydride attack onto an acid chloride is given in scheme 3.
Scheme 3: Mechanism of a hydride attack onto an acid chloride.
We see another key point here: Once the carbonyl has been attacked, the oxide anion has a tendency to ‘rebound’ a lone pair and displace one of the bonded atoms. Generally, the displaced anion must be reasonably favourable for the rebound to occur. Chloride ions are good leaving groups and thus a displacement of chloride is likely to happen. Hydride ions are absolutely absymal leaving groups, so the hydride attack is not reversible.
After the inital attack and displacement of the chloride, we are left with an aldehyde which of course will react quicker and lead to full reduction to the alcohol.
Acid anhydrides are not attacked this way because the initial step does hot happen. If you accidentally got a hydride to attack, the $\ce{^{-}OOC-R}$ leaving group is great and thus a reaction would occur.
The alcohol attack
Alcohol hydroxy groups are still not the best nucleophile but they are better nucleophiles than hydride is. Thus, they even manage to attack acid anhydrides and — to a limited extent — esters and acids. The general mechanism of attack is shown in scheme 4.
Scheme 4: Reaction mechanism of an alcohol attacking an acid chloride including a potential second attack.
The key difference here is that the alcohol is a neutral nucleophile, not an anion like hydride is. Thus, when the rebound occurs, it is susceptible to redisplacement. This is shown in the final equilibrium of the mechanism above. This is also the reason why — under neutral conditions! — an alcohol may attack an aldehyde or a ketone but the attack is not productive. The alcohol will simply be rebounded back out since the hydride is a terrible leaving group.
There is a productive reaction mechanism for alcohols with aldehydes or ketones — the formation of acetals and ketals — however, that generally requires acid catalysis.
Finally, there is also the possibility of base catalysis when alcohols react. It would deprotonate them to give the alcoholate which is a much better nucleophile and even able to attack esters. However, base catalysis is outside of the scope of this question.