Behaviour is the British spelling and behavior is the American variant.
The British spelling is in this case slightly more faithful to the etymology of the word.
The OED has the following etymology of behaviour:
- formed on the verb behave, by form-analogy with havour, havyoure, common 15–16th century forms of the word which was originally the noun aver (q.v.), aveyr, also in 15th century avoir; really Old French aveir, avoir, in sense of ‘having, possession,’ but naturally affiliated in English to the native verb have, and spelt haver, havour, haviour, etc. Hence, by analogy, have: havour, -iour: behave: behavour, -iour.
- The formation might be confirmed by the (apparently) parallel demeanour, from demean (oneself). For the -iour see havour.
The etymology of havour:
- Originally an adoption of the French aveir, avoir ‘having, possession, property, estate, wealth, etc.’, substantive use of avoir, Old French aveir ‘to have’.
- First used in English in the Norman form aveyr [...]; the Central French form avoir appeared about 1400, and displaced aver, except in the northern dialect, where that form survived in a specific sense.
- In 14–15th century, association with the English have, having, introduced the variants haver, havoir, havour, and the h was established before 1500. At the same time the parallel behavour was formed on the English behave; and in 16th century havour, beside its original sense of ‘possession’, took also that of behavour.
- Subsequently the termination of both words passed through -eour to -iour (cf. saviour, and vulgar ‘lovier’); the original sense ‘possession’ became obsolete; and, in the new sense, haviour came down alongside of behaviour, of which it may often have been viewed as a shortened by-form.
The American spelling, behavior, on the other hand, is effectively more 'phonetic' in nature, in that it dispenses with the u (there are only a few exceptions), which is otherwise not pronounced. At the beginning of the 19th century, Noah Webster pushed this change primarily via his dictionary, and Americans gradually adopted the new spelling. Etymonline.com says:
When the Americans began to consistently spell it one way, however, the British reflexively hardened their insistence on the other. "The American abolition of -our in such words as honour and favour has probably retarded rather than quickened English progress in the same direction." [Fowler]
If you're using American English, you should write behavior. If, on the other hand, you're using the British variant, write behaviour. The important thing is to be be consistent, as the commenters say: it'd be considered unusual to have both colour and behavior in the same sentence.
In short: pick a dialect and use it consistently.