Contexts form a hierarchy: Blocks and modules are inside courses, courses are inside categories, etc. Here's a somewhat out-of-date diagram. Moodle uses a user's current context to determine his permissions. So if you're a Teacher in a Course context, you have all the permissions you need to edit and manage the course. Course context is represented in the database by the integer 50.
For more information, read this short article in the documentation wiki.
General developer forum
Whats the significance of Conext table and contextlevel.
This discussion has been locked so you can no longer reply to it.