BGP itself cannot discover routes. Instead, it imports routes discovered by other protocols such as an IGP or the static routing protocol into the BGP routing table. These imported routes are then transmitted within an AS or between ASs.
BGP advertises or receives only the wanted routes after filtering routes to be advertised or received, and modifies route attributes to direct network traffic.