Fundamentally, they're both carbohydrates, although the cellulose in wood is essentially polymerized glucose, which combined with its isomer fructose forms sucrose.
So why does wood readily burn while table sugar chars?
Chemistry Stack Exchange is a question and answer site for scientists, academics, teachers, and students in the field of chemistry. It only takes a minute to sign up.
Sign up to join this communityFundamentally, they're both carbohydrates, although the cellulose in wood is essentially polymerized glucose, which combined with its isomer fructose forms sucrose.
So why does wood readily burn while table sugar chars?
Combustion is a gas phase reaction. The heat of the flame vapourises the substrate and it's the vapour that reacts with the air. That's why heat is needed to get combustion started.
Anyhow, wood contains lots of relatively volatile compounds so it's not too hard to get combustion started. Once combustion has started the heat of the flame keeps the reaction going.
However sugar dehydrates and emits water when you heat it. Water isn't flammable (obviously) so there's no way to get combustion started. Dehydration leaves behind pure carbon and that is non-volatile so again there's no way to get this to burn. Carbon will burn of course, but you need a high temperature to get it going.
With hydrocarbons a certain amount of oxygen (n) and a certain amount of heat energy (Q) are required for complete combustion. In complete combustion the byproducts are carbon dioxide and water in the form of steam.
$$\ce{C_xH_yO_z + nO_2 + Q -> xCO2 + \frac{y}{2}H2O}$$
Hypothetically, if wood and sugar were assumed to have an identical chemical composition and supplied the exact same amount of heat energy, then any difference in the reaction would need to be derived from the amount of oxygen.
A lack of oxygen is why sugar does not readily burn. This reaction was demonstrated back in the day by Mr. Wizard. He added some oxygen in a chemical form which made table sugar go up in flames quickly.
If oxygen is not readily available then another reaction, called pyrolysis, occurs. This reaction often gives off some combination of methane, hydrogen gas, and carbon monoxide, all of which are flammable, and often leaves behind carbon. This carbon can be observed as char. $$\ce{C_xH_yO_z + Q -> aH2 + bCO + cCH4 + dCO2 + eH2O + fC }$$
The answer to the question is oxygen cannot readily get to the pile of sugar, which is why it does not burn well and it displays the byproducts of pyrolysis. In this situation the wood is undergoing pyrolysis as well; however, enough oxygen is available such that all of the pyrolytic byproducts burn leading to complete combustion.
It's a matter of physics more than of chemistry. If you apply a lit match to a log, it won't catch fire. Doing the same to a (headless) matchstick will set it alight immediately. This is because the matchstick is surrounded by flame and heats up quickly as it is so thin. If you apply a match similarly to a stick of sugar as thin as a matchstick, then it will burn too. However, the sugar will melt as it heats up, and the burning sugar will tend drip off the remaining stick so that the combustion will not propagate as well.
There is also a chemical reason why cellulose inflames more readily than sucrose (ignoring the lignin content of wood for the present). Because of the additional cross-linkages, cellulose is more stable, and will start to decompose at higher temperatures than does sucrose. At the lower temperature of sucrose decomposition, the main reaction is loss of water vapour, which is incombustible, leaving behind a carbon-rich char which does not ignite so readily at moderate temperatures. While the same process happens as cellulose heats up, at the higher temperature of decomposition, volatile organic compounds, which are combustible, are produced in addition. As these ignite, the flame is enhanced and propagates by positive feedback. The same effects apply a fortiori to lignin in comparison with sucrose.
As noted in other answers, commercial table sugar is typically crystalline and the bulk of it must undergo a phase change into a form accessible to oxygen in the air. Melting the sugar consumes energy and may slow down its reaction (the melting point is reported to be ~186 $^o$C). According to more recent studies sugar undergoes thermal decomposition rather than melting. This suggests that the process of combustion of sugar is complex and can involve both thermal decomposition and oxidation by air. Presumably the formation of the molten caramelized mass reduces access to oxygen unless very high temperatures encourage further reaction with air.
Cellulose within dried wood also contains crystalline domains, as well as amorphous ones, but their size is smaller and the energy required to induce phase changes that provide access to air is presumably less. The polymeric structure probably interferes with decomposition and the porous structure of wood aids access to air.
As an interesting corollary to this problem and some of the answers and comments, the generation of coke from raw coal (containing impurities such as sulfur compounds) via heating in the absence of oxygen generates a cleaner burning carbon energy source.
EDIT: added consideration of thermal decomposition of sugar.
This is an experimental answer to a slightly different question. The way the question is asked, it is confounded by the substances wood and sugar. If wood and sugar are removed from the question it will read...
Why does substance A burn but not substance B?
Substance A and B are both carbohydrates of similar composition. So why does substance A readily burn but substance B chars?
The fact that A burns and B chars is the key piece of information to discovering the correct answer. Imagine substance A and B are both granulated cellulose. (Cellulose happens to be both sugar and the dominant component of wood.)
This is a picture of what is left when substance A is heated to 550°C in the presence of air.
This is a picture of what is left when substance B is heated to 550°C in the absence of air.
Because the question says substance A burned and substance B charred the right answer is most likely substance A had enough oxygen for combustion while substance B did not.
In the original question, too many unknowns have the potential to affect the right answer. The heat energy of the ignition flame is an unknown. The type and size of wood are unknown. The granularity of the sugar is unknown. The size and shape of the sugar pile are unknown. The presence or absence of any controlled conditions is an unknown. The presence or absence of a flame is an unknown.
Because wood burns it is clearly evident that both heat and oxygen are present. Because the sugar chars it is clearly evident that heat was present but oxygen was deficient. Any explanation beyond this involves some level of speculation as to the conditions implied by the question.
-- cautionary note about speculation --
Once speculation starts, weird answers can become true. For example, If someone posted an answer says that the sugar was buried under a campfire while the wood was in a campfire. The question mentions no campfire nor does it say anything about burying sugar, it cannot be said for certain that this answer is right or wrong.
If the explanation is embellished with interesting facts it could sound awesome, but be completely wrong if one thing is off. For example, someone could point out sugar makes caramel at 186°C and that wood contains a very flammable group of compounds called terpenes. The question mentions no formation of caramel so there is no telling if it is present or not. It is not known the extent to which the wood is dried so terpenes may not be significant. It is not possible to say for certain if these explanations are right or wrong.
The oxygen (chemically reduced oxygen; that is, essentially, water) content of sugar is very high. It's already highly oxidised.
$$ \begin{array}{llr} \hline \text{Compound} & \text{Formula} & \text{Oxygen}/\text{wt %} \\ \hline \text{Glucose} & \ce{C6H12O6} & 53 \\ \text{Saccarose} & \ce{C12H22O11} & 51 \\ \text{Cellulose} & \ce{C12H20O10} & 49 \\ \text{Dry wood} & & \sim 35 \\ \hline \end{array} $$
The oligo- and polysaccharides have lost water after polymerisation, but not very much. Cotton is not very flammable. That's why labwear is required to be made of cotton (plus it doesn't melt and then stick to your skin).
Wood however is not just a carbohydrate, but has a high content of lignin, which contains much less oxygen and has a sum formula in the range of $\ce{C3H3O}$.
Very simply put, you have to boil a lot of water out of sugar before anything can actually burn. If you look at the sum formulas above, about two thirds of the mass and all the hydrogen are gone at that point. Pyrolysis of sugar gives water + carbon, and very little flameable volatiles. Which are what you see on burning wood. When all the volatiles are pyrolysed out of the wood, the remaining charcoal is hot enough that it keeps burning.
Sugar has the additional problem that it melts, which makes it burn even worse, because the grainy or powdery structure fuses into a closed surface with good internal heat conductivity. There is an old trick, mixing sugar with ash, which makes it burn a lot better. Cellulose doesn't melt, that's why paper burns much better than sugar. (And because it's thin, a complete book is not so easy to burn completely.)
Btw. the autoignition temperature of sugar (probably saccharose) is ~410°C, wood 280-340°C. (from de:wp, without reference unfortunately)