To say that something bad almost happened (but didn't), you can add the word 差点 (chàdiǎn) before the verb. You will also hear 差点儿 (chàdiǎnr) in northern China. There is no difference in meaning between 差点 and 差点儿 in Chinese grammar.
Literal Meaning
It might help to understand the literal meaning of the structure. The word 差 (chà) has a lot of meanings. In this case, it means "to lack," or "to be short." So in Chinese, the way to say "almost" is to say, "lacking that little bit." If that "little bit" hadn't been lacking, it would have happened. But it was lacking, so it didn't happen... it almost happened.
Structure
subject+差点(儿)+[verb phrase]+了
Note that the "Verb Phrase" part of the structure is usually something bad, and that it didn't happen.
Examples
我们 队 差点儿 输了。